/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elaborate.tag_analysis.client.actions;

import elaborate.tag_analysis.client.ServiceContext;
import java.awt.event.ActionEvent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *
 * @author lendle
 */
public abstract class BaseActionHandler implements ActionHandler{
    protected ServiceContext context=null;
    protected static ExecutorService executorService = null;
    
    static{
        executorService=Executors.newFixedThreadPool(3);
    }
    
    @Override
    public void init(ServiceContext context) {
        this.context=context;
    }

    @Override
    public void handle(final ActionEvent event) {
        executorService.execute(new Runnable(){

            @Override
            public void run() {
                asyncHandleAction(event);
            }
        });
    }
    
    protected abstract void asyncHandleAction(ActionEvent event);
}
